package utils.binarytree;

/**
 * @author yaohuaiying
 * @create 2018-02-08 14:21
 **/
public class TreeNode {
    private int data ;
    private TreeNode left;
    private TreeNode right;

    public TreeNode(int data) {
        this.data = data;
        this.left = null;
        this.right = null;
    }

    public int getData() {
        return data;
    }

    public void setData(int data) {
        this.data = data;
    }

    public TreeNode getLeft() {
        return left;
    }

    public void setLeft(TreeNode left) {
        this.left = left;
    }

    public TreeNode getRight() {
        return right;
    }

    public void setRight(TreeNode right) {
        this.right = right;
    }

    public static int getMaxDeepthHelper(TreeNode currentTreeNode){
        if(currentTreeNode == null){
            return 0;
        }
        int left = getMaxDeepthHelper(currentTreeNode.getLeft());
        int right = getMaxDeepthHelper(currentTreeNode.getRight());
        return Math.max(left,right) + 1;
    }

}
